<%@ page import="org.xilin.Course" %>
<%@ page import="org.xilin.Semester" %>
<g:setProvider library="jquery"/>

<g:if test="${flash.message}">
  <div class="message">${flash.message}</div>
</g:if>

<x:pager/>
<table id="courseTable" class="tablesorter">
    <thead>
        <tr>
            <th>${message(code: 'course.name.label', default: 'Name')}</th>
            <th>${message(code: 'course.grade.label', default: 'Grade')}</th>
            <th style="display:none">${message(code: 'course.capacity.label', default: 'Capacity')}</th>
            <th style="display:none">${message(code: 'course.regCapacity.label', default: 'Reg Cap.')}</th>
            <th>${message(code: 'course.price.label', default: 'Price')}</th>
            <th>${message(code: 'course.startTime.label', default: 'Start Time')}</th>
            <th>${message(code: 'course.endTime.label', default: 'End Time')}</th>
            <th>${message(code: 'course.teacher.label', default: 'Teacher')}</th>
            <th>${message(code: 'course.book.label', default: 'Book')}</th>
            <th>${message(code: 'course.semester.label', default: 'semester')}</th>
            <th style="display:none">${message(code: 'course.status.label', default: 'Status')}</th>       
        </tr>
    </thead>
    <tbody>
    <g:each in="${courseInstanceList}" status="i" var="courseInstance">
        <tr>
            <td class="show"><a href="#" title="Course Detail" rel="${request.contextPath}/course/show/${courseInstance.id}">${fieldValue(bean: courseInstance, field: "name")}</a></td>
            <td>${fieldValue(bean: courseInstance, field: "grade")}</td>
            <td style="display:none">${fieldValue(bean: courseInstance, field: "capacity")}</td>
            <td style="display:none">${fieldValue(bean: courseInstance, field: "regCapacity")}</td>
            <td>${fieldValue(bean: courseInstance, field: "price")}</td>
            <td>${fieldValue(bean: courseInstance, field: "startTime")}</td>
            <td>${fieldValue(bean: courseInstance, field: "endTime")}</td>
            <td>${fieldValue(bean: courseInstance, field: "teacher")}</td>
            <td>${fieldValue(bean: courseInstance, field: "book")}</td>
            <td>${fieldValue(bean: courseInstance, field: "semester")}</td>
            <td style="display:none">${fieldValue(bean: courseInstance, field: "status")}</td>
           
        </tr>
    </g:each>
    </tbody>
</table>
<script type="text/javascript">
  $(function(){
      setupAdminList({controller:'course', action:'list'});
  });
</script>